package com.lanxin.oa.login.dao;

import com.lanxin.base.BaseDaoImpl;
import com.lanxin.bean.ZzAccount;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class LoginDaoImpl extends BaseDaoImpl implements LoginDao{

	public ZzAccount selectaccount(String username, String password) {
		List list= queryAll("from ZzAccount a left join fetch a.employee where a.username='"+username+"' and a.password='"+password+"'");
		if(list!=null && list.size()>0){
			return (ZzAccount)list.get(0);
		}
		return null;
	}

	@Override
	public List selectEmp_Role_function(Integer empid) {
		return queryAll("select distinct e from ZzEmployee e left join fetch e.qxRoles q left join fetch q.functions where e.oid="+empid);
	}

	@Override
	public List selectAllEmp_Role_function() {
		return queryAll("from QxFunction");
	}

}
